<template>
	<!-- <view class="p-nav">
		<u-row>
			<u-col span="3" class="back" @tap="$u.route({type:'back'})">
				<image src="../../static/newback.png"></image>
			</u-col>
			<u-col span="6" class="title">护理咨询</u-col>
			<u-col span="3" class="right-btn">&nbsp;</u-col>
		</u-row>
	</view> -->
	<view class="content">
		<div class="container">
			<div class="address">
				<input type="text"
					style="width:100%;background-color:#02B730;border: none;color: white;font-weight: bold;font-size: 30px;text-align: center;">
			</div>
			<div class="date-time father-div">
				<div class="date" id="clockDate">{{clockDate}}</div>
				<div class="time" id="clockTime">{{clockTime}}</div>
			</div>
			<div class="father-div">
				<div class="name" style="border-bottom: 0.5px solid #fcfcfc;">
					<div style="text-align: left;font-size:20px;font-weight:bold;margin: 10px 10px;">王*</div>
					<div style="font-size: 15px;margin:5px 10px;color: #898a8a">411326********0010<span></span></div>
				</div>
				<div class="hesuanjieguo">
					<div style="width: 40vw;height: 26vw;background-color: #7de079;color: #fff;">
						<div style="text-align: center;margin-top: 5px;">核酸检测结果</div>
						<div style="display: flex;flex-direction: row;align-items: center;font-weight: bold;">
							<div style="font-size: 50px;margin:0 5px;">48</div>
							<div style="display: flex;flex-direction: column;align-items: center;">
								<div style="font-size: 15px;">小时内</div>
								<div style="font-size: 20px;">阴性</div>
							</div>
						</div>
					</div>
					<div style="width: 40vw;height: 26vw;background-color: #f7f9fc;font-weight: bold;">
						<div
							style="display: flex;flex-direction: column;align-items: center;justify-content: center;font-weight: bold;">
							<div style="color: #414745;margin-top: 15px;">疫苗接种</div>
							<div style="color: #3DB6F5;font-size: 18px;padding: 0 5px;margin-top: 15px;">
								已接种&nbsp;3&nbsp;针剂</div>
						</div>
					</div>
				</div>
			</div>
			<div class="father-div">
				<div class="hesuanguoqi">
					<div style="width: 40vw;height: 26vw;background-color: #fff;">
						<div
							style="display: flex;flex-direction: column;align-items: center;justify-content: center;font-weight: bold;">
							<div style="color: #000;margin-top: 2px;font-weight: bold;">最近核酸检测</div>
							<div class="caiyangshijian">采样时间</div>
							<div id="jianceDate" style="color: #717171;padding: 0 5px;margin-top: 2px;">{{jianceDate}}</div>
						</div>
					</div>
					<div style="width: 40vw;height: 26vw;background-color: #f7f9fc;">
						<div
							style="display: flex;flex-direction: column;align-items: center;justify-content: center;font-weight: bold;">
							<div style="color: #3DB6F5;margin-top: 15px;">距到期还剩</div>
							<div style="color: #3DB6F5;padding: 0 5px;margin-top: 15px;"><span
									style="font-size: 25px;">32</span><span
									style="font-size: 12px;">小时&nbsp;</span><span
									style="font-size: 25px;">36</span><span style="font-size: 12px;">分</span></div>
						</div>
					</div>
				</div>
			</div>
			<div class="checkCard">查看行程卡</div>
		</div>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				clockDate:"",
				clockTime:"",
				jianceDate:"",
			}
		},
		onLoad() {
			this.showDateTime();
			this.showDate();
			//设置定时器，自动更新时间显示
			setInterval(this.showDateTime, 1000);
		},
		onShow() {
			
		},
		methods: {
			showDateTime() {
				//获取系统时间
				let hour = new Date().getHours();
				let minute = new Date().getMinutes();
				let second = new Date().getSeconds();
				hour = hour < 10 ? '0' + hour : hour;
				minute = minute < 10 ? '0' + minute : minute;
				second = second < 10 ? '0' + second : second;
				//搞一个空字符串
				let showTime = "";
				//把时间显示的格式放进去
				showTime = hour + ":" + minute + ":" + second;
				//然后在网页上显示出来
				this.clockTime = showTime;
				// document.getElementById("clockTime").innerHTML = showTime;
			},
			showDate() {
				var date = new Date();
				var y = date.getFullYear();
				var m = date.getMonth() + 1;
				m = m < 10 ? '0' + m : m;
				var d = date.getDate();
				d = d < 10 ? ('0' + d) : d;
				var formatDate = y + '年' + m + '月' + d + '日';
		
				console.log("当天日期是：", formatDate);
				this.clockDate = formatDate;
				// document.getElementById("clockDate").innerHTML = formatDate;
				// jianceDate
				var jcm = date.getMonth() + 1;
				jcm = jcm < 10 ? '0' + jcm : jcm;
				var jcd = date.getDate() > 2 ? (date.getDate()-1):date.getDate();
				jcd = (jcd) < 10 ? ('0' + (jcd)) : (jcd);
				var jcDate = m + '月' + jcd + '日';
				
				// 
				//获取系统时间
				let jchour = new Date().getHours();
				let jcminute = new Date().getMinutes();
				jcminute = jcminute < 10 ? '0' + jcminute : jcminute;
				//搞一个空字符串
				let jcTime = "";
				//把时间显示的格式放进去
				jcTime = jchour + ":" + jcminute
				this.jianceDate = jcDate + ' '+ jcTime;
				// document.getElementById("jianceDate").innerHTML = jcDate + ' '+ jcTime;
			},
		}
	}
</script>

<style>
	.content {
		background: url() no-repeat;
		background-size: 100% 75%;
		margin: 0;
		font-family: Arial;
	}
	/* background-color: #02B730; */
	/* 大容器 */
	.container{
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
		/* background: #f0edf2; */
	}
	/* 大容器中的每一个一级父模块 */
	.father-div{
		width: 88%;
		margin-bottom: 20px;
		border-radius: 5px;
		/* border: 0.5px solid #aaaaaa; */
		box-shadow:1px 1px .2px #f0edf2;
		background: #fff;
	}
	/* 地址*/
	.address{
		margin-top: 15px;
		width: 88%;
		margin-bottom: 15px;
	}
	/* 日期和时间 */
	.date-time{
		margin-top: 30px;
	}
	
	.date {
		padding-top: 15px;
		color: #706F70;
		text-align: center;
		font-size: 17px;
		font-weight: bold;
	}
	
	.time {
		margin-bottom: 15px;
		color: #000000;
		text-align: center;
		font-size: 50px;
		font-weight: bold;
	}
	/* 核酸检测结果 和 疫苗接种情况*/
	.hesuanjieguo ,.hesuanguoqi{
		display: flex;
		flex-direction: row;
		justify-content: space-around;
		align-items: center;
	}
	.hesuanguoqi>div,.hesuanjieguo>div{
		border-radius: 5px;
		margin:8px;
	}
	/* 核算检测时间 和 检测到期时间*/
	
	/* 查看行程卡 */
	.checkCard{
		width: 70vw;
		height: 40px;
		font-size: 20px;
		line-height: 40px;
		color: #02B730;
		border: 1px solid #02B730;
		border-radius: 60px;
		text-align: center;
		margin: 2vh 0;
	}
	.caiyangshijian{
		width: 70%;
		height: 30px;
		font-size: 15px;
		line-height: 30px;
		color: #3DB6F5;
		border: 1px solid #3DB6F5;
		border-radius: 30px;
		text-align: center;
		margin-top: 3px;
	}
</style>
